home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
qtawk
/
ansiclst.exp
< prev
next >
Wrap
Text File
|
1990-04-30
|
7KB
|
156 lines
# QTAwk program to scan C source files for keywords defined in the ANSI C
# standard keywords:
# macro or function names defined in the standard
# types or constants defined in the standard
#
# compare to ansicstd.exp program which uses 'GROUP'
#
# input: C source file
# output: all lines containing ANSI C standard defined keywords
#
#
BEGIN {
#
# ANSI C key words
#
# expression for leader
ldr = /(^|{_w})/;
# opening function parenthesis - look-ahead to find
o_p = /@{_w}*\(/;
}
#
#
# Following are macro or functions names as defined by ANSI C standard
#
# 1
/{ldr}assert{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",1,FNR,$0,$$0); next; }
# 2
/{ldr}is(al(num|pha)|cntrl|x?digit|graph|lower|p(rint|unct)|space|upper){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",2,FNR,$0,$$0); next; }
# 3
/{ldr}to(lower|upper){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",3,FNR,$0,$$0); next; }
# 4
/{ldr}set(locale|v?buf){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",4,FNR,$0,$$0); next; }
# 5
/{ldr}a(cos|sin|tan2?|bort){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",5,FNR,$0,$$0); next; }
# 6
/{ldr}(cos|sin|tan)h?{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",6,FNR,$0,$$0); next; }
# 7
/{ldr}(fr|ld)?exp{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",7,FNR,$0,$$0); next; }
# 8
/{ldr}log(10)?{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",8,FNR,$0,$$0); next; }
# 9
/{ldr}modf{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",9,FNR,$0,$$0); next; }
# 10
/{ldr}pow{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",10,FNR,$0,$$0); next; }
# 11
/{ldr}sqrt{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",11,FNR,$0,$$0); next; }
# 12
/{ldr}ceil{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",12,FNR,$0,$$0); next; }
# 13
/{ldr}(f|l)?abs{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",13,FNR,$0,$$0); next; }
# 14
/{ldr}f(loor|mod){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",14,FNR,$0,$$0); next; }
# 15
/{ldr}jmp_buf{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",15,FNR,$0,$$0); next; }
# 16
/{ldr}(set|long)jmp{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",16,FNR,$0,$$0); next; }
# 17
/{ldr}signal{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",17,FNR,$0,$$0); next; }
# 18
/{ldr}raise{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",18,FNR,$0,$$0); next; }
# 19
/{ldr}va_(arg|end|list|start){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",19,FNR,$0,$$0); next; }
# 20
/{ldr}re(move|name|wind){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",20,FNR,$0,$$0); next; }
# 21
/{ldr}tmp(file|nam){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",21,FNR,$0,$$0); next; }
# 22
/{ldr}(v?[fs])?printf{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",22,FNR,$0,$$0); next; }
# 23
/{ldr}[fs]?scanf{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",23,FNR,$0,$$0); next; }
# 24
/{ldr}f?get(c(har)?|s|env){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",24,FNR,$0,$$0); next; }
# 25
/{ldr}f?put(c(har)?|s){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",25,FNR,$0,$$0); next; }
# 26
/{ldr}ungetc{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",26,FNR,$0,$$0); next; }
# 27
/{ldr}f(close|flush|(re)?open|read|write|[gs]etpos|seek|tell|eof|ree|pos_t){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",27,FNR,$0,$$0); next; }
# 28
/{ldr}clearerr{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",28,FNR,$0,$$0); next; }
# 29
/{ldr}[fp]error{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",29,FNR,$0,$$0); next; }
# 30
/{ldr}ato[fil]{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",30,FNR,$0,$$0); next; }
# 31
/{ldr}str(to(d|k|u?l)|n?c(py|at|mp)|coll|r?chr|c?spn|pbrk|str|error|len){o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",31,FNR,$0,$$0); next; }
# 32
/{ldr}nd{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",32,FNR,$0,$$0); next; }
# 33
/{ldr}(c|m|re)?alloc{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",33,FNR,$0,$$0); next; }
# 34
/{ldr}?exit{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",34,FNR,$0,$$0); next; }
# 35
/{ldr}(f|mk|asc|c|gm|local|strf)?time{o_p}/ { printf("Macro/function\n%uE - %luR: %s\n%s\n",35,FNR,$0,$$0); next; }
#
# following are types or constants
#
# 36
/errno/ { printf("type/constant\n%uE - %luR: %s\n%s\n",36,FNR,$0,$$0); next; }
# 37
/NULL/ { printf("type/constant\n%uE - %luR: %s\n%s\n",37,FNR,$0,$$0); next; }
# 38
/offsetof/ { printf("type/constant\n%uE - %luR: %s\n%s\n",38,FNR,$0,$$0); next; }
# 39
/ptrdiff_t/ { printf("type/constant\n%uE - %luR: %s\n%s\n",39,FNR,$0,$$0); next; }
# 40
/size_t/ { printf("type/constant\n%uE - %luR: %s\n%s\n",40,FNR,$0,$$0); next; }
# 41
/NDEBUG/ { printf("type/constant\n%uE - %luR: %s\n%s\n",41,FNR,$0,$$0); next; }
# 42
/LC_(ALL|COLLATE|CTYPE|NUMERIC|TIME)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",42,FNR,$0,$$0); next; }
# 43
/E(DOM|RANGE|OF)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",43,FNR,$0,$$0); next; }
# 44
/HUGE_VAL/ { printf("type/constant\n%uE - %luR: %s\n%s\n",44,FNR,$0,$$0); next; }
# 45
/sig_atomic_t/ { printf("type/constant\n%uE - %luR: %s\n%s\n",45,FNR,$0,$$0); next; }
# 46
/SIG(_(DFL|ERR|IGN)|ABRT|FPE|ILL|INT|SEGV|TERM)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",46,FNR,$0,$$0); next; }
# 47
/FILE/ { printf("type/constant\n%uE - %luR: %s\n%s\n",47,FNR,$0,$$0); next; }
# 48
/_IO[FLN]BF/ { printf("type/constant\n%uE - %luR: %s\n%s\n",48,FNR,$0,$$0); next; }
# 49
/BUFSIZ/ { printf("type/constant\n%uE - %luR: %s\n%s\n",49,FNR,$0,$$0); next; }
# 50
/L_tmpnam/ { printf("type/constant\n%uE - %luR: %s\n%s\n",50,FNR,$0,$$0); next; }
# 51
/(OPEN|RAND|TMP|U(CHAR|INT|LONG|SHRT))_MAX/ { printf("type/constant\n%uE - %luR: %s\n%s\n",51,FNR,$0,$$0); next; }
# 52
/SEEK_(CUR|END|SET)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",52,FNR,$0,$$0); next; }
# 53
/std(err|in|out)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",53,FNR,$0,$$0); next; }
# 54
/l?div_t/ { printf("type/constant\n%uE - %luR: %s\n%s\n",54,FNR,$0,$$0); next; }
# 55
/CLK_TCK/ { printf("type/constant\n%uE - %luR: %s\n%s\n",55,FNR,$0,$$0); next; }
# 56
/(clock|time)_t/ { printf("type/constant\n%uE - %luR: %s\n%s\n",56,FNR,$0,$$0); next; }
# 57
/tm_(sec|min|hour|[mwy]day|mon|year|isdst)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",57,FNR,$0,$$0); next; }
# 58
/CHAR_(BIT|M(AX|IN))/ { printf("type/constant\n%uE - %luR: %s\n%s\n",58,FNR,$0,$$0); next; }
# 59
/(INT|LONG|S(CHAR|HRT))_(M(IN|AX))/ { printf("type/constant\n%uE - %luR: %s\n%s\n",59,FNR,$0,$$0); next; }
# 60
/(L?DBL|FLT)_((MANT_)?DIG|EPSILON|M(AX|IN)(_(10_)?EXP)?)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",60,FNR,$0,$$0); next; }
# 61
/FLT_R(ADIX|OUNDS)/ { printf("type/constant\n%uE - %luR: %s\n%s\n",61,FNR,$0,$$0); }
FINAL {
printf("Total Lines Scanned: %lu\n",FNR);
printf("Total Line containing macro/function names: %lu\n",mf_count);
printf("Total Line containing type/constant names: %lu\n",tc_count);
}